<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
//定义变量
    var name = "LMX";
    let age = 30;

//读取变量
    console.log(name);
    console.log(age);
//输入
    name = prompt("请重新输入姓名");
//输出/打印变量
    alert(name);
//数据类型：
    // 1.数字类型(特殊值)：
        var max = 1/0;
        console.log(max);  //Infinity
        var min = -1/0;
        console.log(min);   //-Infinity
        var str = "哈哈哈";
        console.log(str - 1);    //NaN    
    // 2.String类型
        var a = "haha";
        var b = 'hehe';
        // var msg0 = "My name is "LMX"";    
        // 出错
        var msg1 = "My name is \"LMX\"";  
        // 正确, 使用转义字符. \" 来表示字符串内部的引号. 
        var msg2 = "My name is 'LMX'";    
        // 正确, 搭配使用单双引号
        var msg3 = 'My name is "LMX"';    
        //alert(msg1);
        console.log(msg1.length);
        console.log(10+10); //20
        console.log("10"+10);   //1010
    //3.boolean类型
        var x = true;
        console.log("x的类型为" + typeof(x) + "值为" + x);
        x += 1;
        console.log("x的类型为" + typeof(x) + "值为" + x);
    //4.undefined未定义的类型
        let m;
        console.log(m); //undefined
        console.log(m + true);  //NaN
        console.log(m + 10);    //NaN
        console.log(m + "10");  //undefined10
        //5.null类型
        let n = null;
        console.log(n + "10");  //null10
        console.log(n + 10);  //10
//运算符:
        //==比较的是数值
        console.log("10" == 10);    //true
        //===比较的是数值＋类型
        console.log("10" === 10);   //false
        //其余运算符相同
</script>
</html>